package com.lukk.service.impl;

import javax.annotation.Resource;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.stereotype.Service;

import com.lukk.dao.CityCostRuleDAO;
import com.lukk.dao.WorkerDAO;
import com.lukk.pojo.CityCostRule;
import com.lukk.pojo.Worker;
import com.lukk.service.ICityCostRuleService;

/**
 * 
 * CityCostRuleServiceImpl 上午10:24:47
 * 
 * Copyright zhaocj Inc. All rights reserved.
 * Love ME Like Justin Bieber.
 */
@Service("cityCostRuleService")
public class CityCostRuleServiceImpl implements ICityCostRuleService {
	private static Logger logger = LogManager.getLogger(CityCostRuleServiceImpl.class.getName());
	@Resource
	CityCostRuleDAO cityCostRuleDAO;
	@Resource
	WorkerDAO workerDAO;

	@Override
	public CityCostRule selectCostRuleByCityCode(String cityCode) {
		return cityCostRuleDAO.selectCostRuleByCityCode(cityCode, 1);
	}

	@Override
	public CityCostRule queryCostRuleByWorkerID(Integer workerID) {
		Worker worker = workerDAO.selectByPrimaryKey(workerID);
		CityCostRule cityCostRule = cityCostRuleDAO.selectCostRuleByCityCode(worker.getWorkerSpaceCodeStr(), 0);
		return cityCostRule;
	}
}
